﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Model.Enum;

namespace Model
{
    [Serializable]
    public class Sys5a01
    {

        private string _listid;
        private string _plistid;
        private int _orderid;
        private string _colname;
        private string _headcn;
        private PsDataType _coltype;
        private bool _isquery;
        private bool _isshow;
        private string _oname;
        private string _fmt;
        private ControlType _controltype;
        private int _maxlength;
        private int _digits;
        private string _defvalue;
        private bool _iskey;
        private bool _notnull;
        private int _columnwidth;
        private int _colspan;
        private string _columnoption;
        private string _columnparam;
        private string _tp1;
        private string _tp2;
        private string _tp3;
        private string _tp4;
        private string _tp5;
        private string _remark;
        private string _tp6;
        private string _tp7;
        private string _tp8;
        private string _tp9;
        private string _tp10;

        private string _editmode;

        /// <summary>
        /// 可编辑模式
        /// </summary>
        public string Editmode
        {
            get { return _editmode; }
            set { _editmode = value; }
        }



        /// <summary>
        /// 主键标识
        /// </summary>
        public string Listid
        {
            get { return _listid; }
            set { _listid = value; }
        }
        /// <summary>
        /// 页面标识
        /// </summary>
        public string Plistid
        {
            get { return _plistid; }
            set { _plistid = value; }
        }
        /// <summary>
        /// 序号
        /// </summary>
        public int Orderid
        {
            get { return _orderid; }
            set { _orderid = value; }
        }
        /// <summary>
        /// 字段名称
        /// </summary>
        public string Colname
        {
            get { return _colname; }
            set { _colname = value; }
        }
        /// <summary>
        /// 中文表头
        /// </summary>
        public string Headcn
        {
            get { return _headcn; }
            set { _headcn = value; }
        }
        /// <summary>
        /// 类型
        /// </summary>
        public PsDataType Coltype
        {
            get { return _coltype; }
            set { _coltype = value; }
        }
        /// <summary>
        /// 是否允许查询
        /// </summary>
        public bool Isquery
        {
            get { return _isquery; }
            set { _isquery = value; }
        }
        /// <summary>
        /// 是否显示
        /// </summary>
        public bool Isshow
        {
            get { return _isshow; }
            set { _isshow = value; }
        }
        /// <summary>
        /// 列别名
        /// </summary>
        public string Oname
        {
            get { return _oname; }
            set { _oname = value; }
        }
        /// <summary>
        /// 格式化
        /// </summary>
        public string Fmt
        {
            get { return _fmt; }
            set { _fmt = value; }
        }
        /// <summary>
        /// 控件类型
        /// </summary>
        public ControlType Controltype
        {
            get { return _controltype; }
            set { _controltype = value; }
        }
        /// <summary>
        /// 最大长度
        /// </summary>
        public int Maxlength
        {
            get { return _maxlength; }
            set { _maxlength = value; }
        }
        /// <summary>
        /// 小数精度
        /// </summary>
        public int Digits
        {
            get { return _digits; }
            set { _digits = value; }
        }
        /// <summary>
        /// 默认值
        /// </summary>
        public string Defvalue
        {
            get { return _defvalue; }
            set { _defvalue = value; }
        }
        /// <summary>
        /// 是否主键
        /// </summary>
        public bool Iskey
        {
            get { return _iskey; }
            set { _iskey = value; }
        }
        /// <summary>
        /// 不允许为空
        /// </summary>
        public bool Notnull
        {
            get { return _notnull; }
            set { _notnull = value; }
        }
        /// <summary>
        /// 字段宽度
        /// </summary>
        public int Columnwidth
        {
            get { return _columnwidth; }
            set { _columnwidth = value; }
        }
        /// <summary>
        /// 跨列
        /// </summary>
        public int Colspan
        {
            get { return _colspan; }
            set { _colspan = value; }
        }
        /// <summary>
        /// 选项
        /// </summary>
        public string Columnoption
        {
            get { return _columnoption; }
            set { _columnoption = value; }
        }
        /// <summary>
        /// 参数
        /// </summary>
        public string Columnparam
        {
            get { return _columnparam; }
            set { _columnparam = value; }
        }
        /// <summary>
        /// 临时参数1
        /// </summary>
        public string Tp1
        {
            get { return _tp1; }
            set { _tp1 = value; }
        }
        /// <summary>
        /// 临时参数2
        /// </summary>
        public string Tp2
        {
            get { return _tp2; }
            set { _tp2 = value; }
        }
        /// <summary>
        /// 临时参数3
        /// </summary>
        public string Tp3
        {
            get { return _tp3; }
            set { _tp3 = value; }
        }
        /// <summary>
        /// 临时参数4
        /// </summary>
        public string Tp4
        {
            get { return _tp4; }
            set { _tp4 = value; }
        }
        /// <summary>
        /// 临时参数5
        /// </summary>
        public string Tp5
        {
            get { return _tp5; }
            set { _tp5 = value; }
        }
        /// <summary>
        /// 简要说明
        /// </summary>
        public string Remark
        {
            get { return _remark; }
            set { _remark = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        public string Tp6
        {
            get { return _tp6; }
            set { _tp6 = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Tp7
        {
            get { return _tp7; }
            set { _tp7 = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Tp8
        {
            get { return _tp8; }
            set { _tp8 = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Tp9
        {
            get { return _tp9; }
            set { _tp9 = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Tp10
        {
            get { return _tp10; }
            set { _tp10 = value; }
        }


        public static List<Sys5a01> GetSys5a01ListByDataTable(DataTable dt)
        {
            List<Sys5a01> list = new List<Sys5a01>();

            foreach (DataRow dr in dt.Rows)
            {
                Sys5a01 model = GetSys5a01ByDataRow(dr);
                if (null == model) continue;

                list.Add(model);
            }
            return list;
        }

        public static Sys5a01 GetSys5a01ByDataRow(DataRow dr)
        {
            Sys5a01 model = new Sys5a01(); //实例化Sys5a01

            if (!(dr["listid"] is System.DBNull))
                model.Listid = (string)dr["listid"];
            if (!(dr["plistid"] is System.DBNull))
                model.Plistid = (string)dr["plistid"];
            if (!(dr["orderid"] is System.DBNull))
                model.Orderid = (int)dr["orderid"];
            if (!(dr["colname"] is System.DBNull))
                model.Colname = (string)dr["colname"];
            if (!(dr["headcn"] is System.DBNull))
                model.Headcn = (string)dr["headcn"];
            if (!(dr["coltype"] is System.DBNull))
                model.Coltype = (PsDataType)Convert.ToInt32(dr["coltype"]);
            if (!(dr["isquery"] is System.DBNull))
                model.Isquery = "Y" == dr["isquery"].ToString().ToUpper();
            if (!(dr["isshow"] is System.DBNull))
                model.Isshow = "Y" == dr["isshow"].ToString().ToUpper();
            if (!(dr["oname"] is System.DBNull))
                model.Oname = (string)dr["oname"];
            if (!(dr["fmt"] is System.DBNull))
                model.Fmt = (string)dr["fmt"];
            if (!(dr["controltype"] is System.DBNull))
                model.Controltype = (ControlType)Convert.ToInt32(dr["controltype"]);
            if (!(dr["maxlength"] is System.DBNull))
                model.Maxlength = (int)dr["maxlength"];
            if (!(dr["digits"] is System.DBNull))
                model.Digits = (int)dr["digits"];
            if (!(dr["defvalue"] is System.DBNull))
                model.Defvalue = (string)dr["defvalue"];
            if (!(dr["editmode"] is System.DBNull))
                model.Editmode = (string)dr["editmode"];
            if (!(dr["iskey"] is System.DBNull))
                model.Iskey = "Y" == dr["iskey"].ToString().ToUpper();
            if (!(dr["notnull"] is System.DBNull))
                model.Notnull = "Y" == dr["notnull"].ToString().ToUpper();
            if (!(dr["columnwidth"] is System.DBNull))
                model.Columnwidth = (int)dr["columnwidth"];
            if (!(dr["colspan"] is System.DBNull))
                model.Colspan = (int)dr["colspan"];
            if (!(dr["columnoption"] is System.DBNull))
                model.Columnoption = (string)dr["columnoption"];
            if (!(dr["columnparam"] is System.DBNull))
                model.Columnparam = (string)dr["columnparam"];
            if (!(dr["tp1"] is System.DBNull))
                model.Tp1 = (string)dr["tp1"];
            if (!(dr["tp2"] is System.DBNull))
                model.Tp2 = (string)dr["tp2"];
            if (!(dr["tp3"] is System.DBNull))
                model.Tp3 = (string)dr["tp3"];
            if (!(dr["tp4"] is System.DBNull))
                model.Tp4 = (string)dr["tp4"];
            if (!(dr["tp5"] is System.DBNull))
                model.Tp5 = (string)dr["tp5"];
            if (!(dr["remark"] is System.DBNull))
                model.Remark = (string)dr["remark"];
            if (!(dr["tp6"] is System.DBNull))
                model.Tp6 = (string)dr["tp6"];
            if (!(dr["tp7"] is System.DBNull))
                model.Tp7 = (string)dr["tp7"];
            if (!(dr["tp8"] is System.DBNull))
                model.Tp8 = (string)dr["tp8"];
            if (!(dr["tp9"] is System.DBNull))
                model.Tp9 = (string)dr["tp9"];
            if (!(dr["tp10"] is System.DBNull))
                model.Tp10 = (string)dr["tp10"];

            return model;
        }
    }
}